package com.graduate.twentyone.mapper;

import com.graduate.twentyone.domain.SlideShow;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface SlideShowMapper {

    @Select("select * from slideshow where status=0  order by  slideshow_id  desc")
    List<SlideShow> all();

    @Update("update slideshow  set status=1 where slideshow_id = #{slideshow_id}")
    Integer deleteById(Integer slideshow_id);

    @Update("<script>"
            +"update slideshow "
            + "<set>"
            + " <if test='picture != null'> picture=#{picture} , </if> "
            + " <if test='infor != null'> infor=#{infor} ,</if> "
            + "</set> "
            + "where slideshow_id = #{slideshow_id}"
            +"</script>")
    Integer updateById(SlideShow slideshow);

    @Insert("insert into slideshow  values(null,#{picture},#{infor},0)")
    Integer addOne(SlideShow slideShow);
}
